package com.dzjcloud.dzj.upms.api.form;

import cn.hutool.crypto.SecureUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * <h3>dzj-cloud</h3>
 * <p>用户注册表单</p>
 *
 * @author : DongZeJian
 * @date : 2021-06-01 14:23
 **/
@ApiModel("用户注册表单")
@Data
public class UserRegisteredForm implements Serializable {

    /**
     *  用户账号
     */
    @ApiModelProperty(value = "用户账号",name = "userCode",required = true)
    @NotBlank(message = "用户账号不能为空")
    private String userCode;

    /**
     * 用户密码
     */
    @ApiModelProperty(value = "密码",name = "passwrod",required = true)
    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$",message = "由数字和字母组成，并且要同时含有数字和字母，且长度要在8-16位之间。")
    private String passwrod;

    /**
     * 电话号码
     */
    @ApiModelProperty(value = "电话号码",name = "phone",required = true)
    @NotBlank(message = "电话号码不能为空")
    @Pattern(regexp = "^1(3[0-9]|5[0-3,5-9]|7[1-3,5-8]|8[0-9])\\d{8}$",message = "请填写正确的手机号码")
    private String phone;

    @ApiModelProperty(value = "验证码",required = true)
    @NotBlank(message = "验证码不能为空")
    private String verification;

    public void setVerification(String verification){
        this.verification=verification.toLowerCase();
    }


}
